#pragma once
#ifndef START_H
#define START_H
#include "cocos2d.h"
#include <string>
#include <tuple>


class PlayerSprite;

class Start :public cocos2d::Layer
{
public:
	
	float pickRadius = 20;
	float maxStarDuration = 5;
	float minStarDuration = 3;

	float groundY;
	int score=0;			

	PlayerSprite* player = nullptr;

	cocos2d::Sprite* star = nullptr;
	cocos2d::Label* labelScore= nullptr;

	float timer = 0;
	float starDuration = 0;
	  
	Start(PlayerSprite* player);

	

	float getPlayerDistance();
	cocos2d::Vec2 getNewStarPosition();

	void onPicked();

	void update(float dt) override;

	void spawnNewStar();

	static Start* create(PlayerSprite* player)
	{ 
		Start* pRet = new(std::nothrow) Start(player);
		if (pRet && pRet->init()) 
		{ 
			pRet->autorelease(); 
			return pRet; 
		}
		else 
		{ 
			delete pRet; 
			return nullptr; 
		}
	}

	bool init() override;
};

#endif //START_H